/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Interfaz;

import Clases.cDiagnostico;
import Clases.cDiagnosticoDetalle;
import Clases.cEntrevista;
import java.util.Iterator;

/**
 *
 * @author santiago
 */
public class dlg_DetalleResultado extends javax.swing.JDialog {

    /**
     * Creates new form dlg_DetalleResultado
     */
    
    private cEntrevista Entrevista;
    private cDiagnostico Diagnostico;
    
    public dlg_DetalleResultado(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jScrollPane1 = new javax.swing.JScrollPane();
        jTA_Diagnostico = new javax.swing.JTextArea();
        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jButton3 = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setResizable(false);

        jScrollPane1.setBackground(new java.awt.Color(255, 255, 255));

        jTA_Diagnostico.setColumns(20);
        jTA_Diagnostico.setRows(5);
        jScrollPane1.setViewportView(jTA_Diagnostico);

        jButton1.setBackground(new java.awt.Color(255, 255, 255));
        jButton1.setText("Copiar");

        jButton2.setBackground(new java.awt.Color(255, 255, 255));
        jButton2.setText("Imprimir");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        jButton3.setBackground(new java.awt.Color(255, 255, 255));
        jButton3.setText("Cerrar");
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(jButton1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButton2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 529, Short.MAX_VALUE)
                        .addComponent(jButton3))
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 493, Short.MAX_VALUE)
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton1)
                    .addComponent(jButton2)
                    .addComponent(jButton3))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jButton2ActionPerformed

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
        // TODO add your handling code here:
        this.setVisible(false);
        this.dispose();
    }//GEN-LAST:event_jButton3ActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(dlg_DetalleResultado.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(dlg_DetalleResultado.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(dlg_DetalleResultado.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(dlg_DetalleResultado.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the dialog */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                dlg_DetalleResultado dialog = new dlg_DetalleResultado(new javax.swing.JFrame(), true);
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
                    @Override
                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });
                dialog.setVisible(true);
            }
        });
        
        
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTextArea jTA_Diagnostico;
    // End of variables declaration//GEN-END:variables

    public cEntrevista getEntrevista() {
        return Entrevista;
    }

    public void setEntrevista(cEntrevista Entrevista) {
        this.Entrevista = Entrevista;
        
        this.Diagnostico = Entrevista.getDiagnostico();
        
        MostrarDiagnostico();
    }

    private void MostrarDiagnostico() {
        
        jTA_Diagnostico.append("Diagnostico: " + Diagnostico.getResultado() + "\n");
        
        jTA_Diagnostico.append("\n");
        
        jTA_Diagnostico.append("Valor de minimental evaluado: " + Diagnostico.getMinimental().getMinimentalCalculado().toString()  + "\n");
        
        jTA_Diagnostico.append("\n");
        
        jTA_Diagnostico.append("Detalle de los sub-valores:"  + "\n" );
        jTA_Diagnostico.append("Olvido: " + Diagnostico.getOlvido().toString()  + "\n");
        jTA_Diagnostico.append("Queja: " + Diagnostico.getQueja().toString()  + "\n");
        jTA_Diagnostico.append("Funcional: " + Diagnostico.getFuncional().toString()  + "\n");
        jTA_Diagnostico.append("Carácter: " + Diagnostico.getCaracter().toString()  + "\n");
        
        jTA_Diagnostico.append("Orientacion: " + Diagnostico.getMinimental().getOrientacion().getOrientacionCalculado().toString()  + "\n");
        jTA_Diagnostico.append("\t Orientacion Temporal: " + Diagnostico.getMinimental().getOrientacion().getOrientacionTemporal().getOrientacionTemporalCalculado().toString()  + "\n");
        jTA_Diagnostico.append("\t\t Orientacion Temporal - Semana: " + Entrevista.ContestaDiaSemanaCorrecto().toString()  + "\n");
        jTA_Diagnostico.append("\t\t Orientacion Temporal - Fecha: " + Diagnostico.getMinimental().getOrientacion().getOrientacionTemporal().getFecha().toString()  + "\n");
        jTA_Diagnostico.append("\t\t Orientacion Temporal - Mes: " + Diagnostico.getMinimental().getOrientacion().getOrientacionTemporal().getMes().toString()  + "\n");
        jTA_Diagnostico.append("\t\t Orientacion Temporal - Año: " + Diagnostico.getMinimental().getOrientacion().getOrientacionTemporal().getAno().toString()  + "\n");
        jTA_Diagnostico.append("\t\t Orientacion Temporal - Estacion: " + Diagnostico.getMinimental().getOrientacion().getOrientacionTemporal().getEstacion().toString()  + "\n");

        jTA_Diagnostico.append("\t Orientacion Espacial: " + Diagnostico.getMinimental().getOrientacion().getOrientacionEspacial().getOrientacionEspacialCalculado().toString()  + "\n");
        jTA_Diagnostico.append("\t\t Orientacion Espacial - Lugar: " + Diagnostico.getMinimental().getOrientacion().getOrientacionEspacial().getLugar().toString()  + "\n");
        jTA_Diagnostico.append("\t\t Orientacion Espacial - Calle: " + Diagnostico.getMinimental().getOrientacion().getOrientacionEspacial().getCalle().toString()  + "\n");
        jTA_Diagnostico.append("\t\t Orientacion Espacial - Piso: " + Diagnostico.getMinimental().getOrientacion().getOrientacionEspacial().getPiso().toString()  + "\n");
        jTA_Diagnostico.append("\t\t Orientacion Espacial - Ciudad: " + Diagnostico.getMinimental().getOrientacion().getOrientacionEspacial().getCiudad().toString()  + "\n");
        jTA_Diagnostico.append("\t\t Orientacion Espacial - Pais: " + Diagnostico.getMinimental().getOrientacion().getOrientacionEspacial().getPais().toString()  + "\n");

        jTA_Diagnostico.append("Memoria: " + Diagnostico.getMinimental().getMemoria().getMemoriaCalculado().toString() + "\n");
        jTA_Diagnostico.append("\t Memoria Fijacion: " + Diagnostico.getMinimental().getMemoria().getFijacion().toString()  + "\n");
        jTA_Diagnostico.append("\t Memoria Atencion: " + Diagnostico.getMinimental().getMemoria().getAtencion().toString()  + "\n");
        jTA_Diagnostico.append("\t Memoria Recuerdo: " + Diagnostico.getMinimental().getMemoria().getRecuerdo().toString()  + "\n");

        jTA_Diagnostico.append("Lenguaje: " + Diagnostico.getMinimental().getLenguaje().getLenguajeCalculado().toString() + "\n");
        jTA_Diagnostico.append("\t Lenguaje Frase: " + Diagnostico.getMinimental().getLenguaje().getFrase().toString()  + "\n");
        jTA_Diagnostico.append("\t Lenguaje Orden: " + Diagnostico.getMinimental().getLenguaje().getOrden().toString()  + "\n");
        jTA_Diagnostico.append("\t Lenguaje Escritura: " + Diagnostico.getMinimental().getLenguaje().getEscritura().toString()  + "\n");
        jTA_Diagnostico.append("\t Lenguaje Accion: " + Diagnostico.getMinimental().getLenguaje().getAccion().toString()  + "\n");        
        jTA_Diagnostico.append("\t Lenguaje Accion: " + Entrevista.getCosasNombradas().toString()  + "\n");        

        jTA_Diagnostico.append("Dibujo: " + Diagnostico.getMinimental().getDibujo().toString() + "\n");
        
        jTA_Diagnostico.append("\n");
        jTA_Diagnostico.append("\n");
        
        jTA_Diagnostico.append("Detalles del analisis" + "\n");
        
        Iterator<cDiagnosticoDetalle> it = Diagnostico.getDetalles().iterator();
        //put them into jTable
        while (it.hasNext()) {
            cDiagnosticoDetalle detalle = (cDiagnosticoDetalle) it.next();
            jTA_Diagnostico.append( detalle.getDetalle() + "\n" );
        }
        
        
    }
}
